<html>
<head>
  <script src="sorttable.js"></script>
  <script src="sourceview.js"></script>
  <link rel="stylesheet" type="text/css" href="style.css">
  <title>zcov: /home/vagrant/workspace/proj_libjpeg/cov/rdswitch.c</title>
</head>
<body>
<center><h1> zcov: <a href="index.html">/home/vagrant/workspace/proj_libjpeg/cov</a>/<a href="rdswitch.c.html">rdswitch.c</a> </h1></center>
<hr>


<center>
<table id="headertable" cellpadding=2>
  <tr>
    <td bgcolor=#ACACFF> <b>Files:</b> </td>
    <td bgcolor=#F0F0FF> 1 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Branches&nbsp;Taken:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>0.0%<b> </td>
    <td bgcolor=#F0F0FF align=right> 0&nbsp;/&nbsp;120 </td>
  </tr>
  <tr>
    <td bgcolor=#ACACFF> <b>Generated:</b> </td>
    <td bgcolor=#F0F0FF> 2016-04-07&nbsp;18:20 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Branches&nbsp;Executed:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>0.0%<b> </td>
    <td bgcolor=#F0F0FF align=right> 0&nbsp;/&nbsp;120 </td>
  </tr>
  <tr>
    <td colspan=2> </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Line&nbsp;Coverage:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>0.0%</b> </td>
    <td bgcolor=#F0F0FF align=right> 0&nbsp;/&nbsp;150 </td>
  </tr>
</table>
</center>
<p>
<hr>

<center>
<table id="fileheadertable" cellpadding=2>
  <tr>
    <td bgcolor=#ACACFF> <b>Programs:</b> </td>
    <td bgcolor=#F0F0FF> 1 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Runs</b> </td>
    <td bgcolor=#F0F0FF align=right> 6326 </td>
  </tr>
</table>
</center>
<p>
<hr>

<pre>
<span class="lineNum">       1 </span>                : <I><FONT COLOR="#B22222">/*
<span class="lineNum">       2 </span>                :  * rdswitch.c
<span class="lineNum">       3 </span>                :  *
<span class="lineNum">       4 </span>                :  * Copyright (C) 1991-1996, Thomas G. Lane.
<span class="lineNum">       5 </span>                :  * This file is part of the Independent JPEG Group's software.
<span class="lineNum">       6 </span>                :  * For conditions of distribution and use, see the accompanying README file.
<span class="lineNum">       7 </span>                :  *
<span class="lineNum">       8 </span>                :  * This file contains routines to process some of cjpeg's more complicated
<span class="lineNum">       9 </span>                :  * command-line switches.  Switches processed here are:
<span class="lineNum">      10 </span>                :  *	-qtables file		Read quantization tables from text file
<span class="lineNum">      11 </span>                :  *	-scans file		Read scan script from text file
<span class="lineNum">      12 </span>                :  *	-qslots N[,N,...]	Set component quantization table selectors
<span class="lineNum">      13 </span>                :  *	-sample HxV[,HxV,...]	Set component sampling factors
<span class="lineNum">      14 </span>                :  */</FONT></I>
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : #<B><FONT COLOR="#5F9EA0">include</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;cdjpeg.h&quot;</FONT></B>		<I><FONT COLOR="#B22222">/* Common decls for cjpeg/djpeg applications */</FONT></I>
<span class="lineNum">      17 </span>                : #<B><FONT COLOR="#5F9EA0">include</FONT></B> <B><FONT COLOR="#BC8F8F">&lt;ctype.h&gt;</FONT></B>		<I><FONT COLOR="#B22222">/* to declare isdigit(), isspace() */</FONT></I>
<span class="lineNum">      18 </span>                : 
<span class="lineNum">      19 </span>                : 
<span class="lineNum">      20 </span>                : <B><FONT COLOR="#0000FF">LOCAL</FONT></B>(<B><FONT COLOR="#228B22">int</FONT></B>)
<span class="lineNum">      21 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">text_getc</FONT></B> (FILE * file)</span>
<span class="lineNum">      22 </span>                : <I><FONT COLOR="#B22222">/* Read next char, skipping over any comments (# to end of line) */</FONT></I>
<span class="lineNum">      23 </span>                : <I><FONT COLOR="#B22222">/* A comment/newline sequence is returned as a newline */</FONT></I>
<span class="lineNum">      24 </span>                : {
<span class="lineNum">      25 </span>                :   <B><FONT COLOR="#228B22">register</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B> ch;
<span class="lineNum">      26 </span>                :   
<span class="lineNum">      27 </span><span class="lineNoCov">               0:   ch = getc(file);</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">      28 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (ch == <B><FONT COLOR="#BC8F8F">'#'</FONT></B>) {</span>
<span class="lineNum">      29 </span>                :     <B><FONT COLOR="#A020F0">do</FONT></B> {
<span class="lineNum">      30 </span><span class="lineNoCov">               0:       ch = getc(file);</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
</span><span class="lineNum">      31 </span><span class="lineNoCov">               0:     } <B><FONT COLOR="#A020F0">while</FONT></B> (ch != <B><FONT COLOR="#BC8F8F">'\n'</FONT></B> &amp;&amp; ch != EOF);</span>
<span class="lineNum">      32 </span>                :   }
<span class="lineNum">      33 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> ch;</span>
<span class="lineNum">      34 </span>                : }
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                : 
<span class="lineNum">      37 </span>                : <B><FONT COLOR="#0000FF">LOCAL</FONT></B>(boolean)
<span class="lineNum">      38 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">read_text_integer</FONT></B> (FILE * file, <B><FONT COLOR="#228B22">long</FONT></B> * result, <B><FONT COLOR="#228B22">int</FONT></B> * termchar)</span>
<span class="lineNum">      39 </span>                : <I><FONT COLOR="#B22222">/* Read an unsigned decimal integer from a file, store it in result */</FONT></I>
<span class="lineNum">      40 </span>                : <I><FONT COLOR="#B22222">/* Reads one trailing character after the integer; returns it in termchar */</FONT></I>
<span class="lineNum">      41 </span>                : {
<span class="lineNum">      42 </span>                :   <B><FONT COLOR="#228B22">register</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B> ch;
<span class="lineNum">      43 </span>                :   <B><FONT COLOR="#228B22">register</FONT></B> <B><FONT COLOR="#228B22">long</FONT></B> val;
<span class="lineNum">      44 </span>                :   
<span class="lineNum">      45 </span>                :   <I><FONT COLOR="#B22222">/* Skip any leading whitespace, detect EOF */</FONT></I>
<span class="lineNum">      46 </span>                :   <B><FONT COLOR="#A020F0">do</FONT></B> {
<span class="lineNum">      47 </span><span class="lineNoCov">               0:     ch = text_getc(file);</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">      48 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (ch == EOF) {</span>
<span class="lineNum">      49 </span><span class="lineNoCov">               0:       *termchar = ch;</span>
<span class="lineNum">      50 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">      51 </span>                :     }
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      52 </span><span class="lineNoCov">               0:   } <B><FONT COLOR="#A020F0">while</FONT></B> (isspace(ch));</span>
<span class="lineNum">      53 </span>                :   
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      54 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (! isdigit(ch)) {</span>
<span class="lineNum">      55 </span><span class="lineNoCov">               0:     *termchar = ch;</span>
<span class="lineNum">      56 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">      57 </span>                :   }
<span class="lineNum">      58 </span>                : 
<span class="lineNum">      59 </span><span class="lineNoCov">               0:   val = ch - <B><FONT COLOR="#BC8F8F">'0'</FONT></B>;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      60 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">while</FONT></B> ((ch = text_getc(file)) != EOF) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      61 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (! isdigit(ch))</span>
<span class="lineNum">      62 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">break</FONT></B>;</span>
<span class="lineNum">      63 </span><span class="lineNoCov">               0:     val *= 10;</span>
<span class="lineNum">      64 </span><span class="lineNoCov">               0:     val += ch - <B><FONT COLOR="#BC8F8F">'0'</FONT></B>;</span>
<span class="lineNum">      65 </span>                :   }
<span class="lineNum">      66 </span><span class="lineNoCov">               0:   *result = val;</span>
<span class="lineNum">      67 </span><span class="lineNoCov">               0:   *termchar = ch;</span>
<span class="lineNum">      68 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">      69 </span>                : }
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span>                : 
<span class="lineNum">      72 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(boolean)
<span class="lineNum">      73 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">read_quant_tables</FONT></B> (j_compress_ptr cinfo, <B><FONT COLOR="#228B22">char</FONT></B> * filename,</span>
<span class="lineNum">      74 </span>                : 		   <B><FONT COLOR="#228B22">int</FONT></B> scale_factor, boolean force_baseline)
<span class="lineNum">      75 </span>                : <I><FONT COLOR="#B22222">/* Read a set of quantization tables from the specified file.
<span class="lineNum">      76 </span>                :  * The file is plain ASCII text: decimal numbers with whitespace between.
<span class="lineNum">      77 </span>                :  * Comments preceded by '#' may be included in the file.
<span class="lineNum">      78 </span>                :  * There may be one to NUM_QUANT_TBLS tables in the file, each of 64 values.
<span class="lineNum">      79 </span>                :  * The tables are implicitly numbered 0,1,etc.
<span class="lineNum">      80 </span>                :  * NOTE: does not affect the qslots mapping, which will default to selecting
<span class="lineNum">      81 </span>                :  * table 0 for luminance (or primary) components, 1 for chrominance components.
<span class="lineNum">      82 </span>                :  * You must use -qslots if you want a different component-&gt;table mapping.
<span class="lineNum">      83 </span>                :  */</FONT></I>
<span class="lineNum">      84 </span>                : {
<span class="lineNum">      85 </span>                :   FILE * fp;
<span class="lineNum">      86 </span>                :   <B><FONT COLOR="#228B22">int</FONT></B> tblno, i, termchar;
<span class="lineNum">      87 </span>                :   <B><FONT COLOR="#228B22">long</FONT></B> val;
<span class="lineNum">      88 </span>                :   <B><FONT COLOR="#228B22">unsigned</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B> table[DCTSIZE2];
<span class="lineNum">      89 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      90 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> ((fp = fopen(filename, <B><FONT COLOR="#BC8F8F">&quot;r&quot;</FONT></B>)) == NULL) {</span>
<span class="lineNum">      91 </span><span class="lineNoCov">               0:     fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Can't open table file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">      92 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">      93 </span>                :   }
<span class="lineNum">      94 </span><span class="lineNoCov">               0:   tblno = 0;</span>
<span class="lineNum">      95 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">      96 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">while</FONT></B> (read_text_integer(fp, &amp;val, &amp;termchar)) { <I><FONT COLOR="#B22222">/* read 1st element of table */</FONT></I></span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">      97 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (tblno &gt;= NUM_QUANT_TBLS) {</span>
<span class="lineNum">      98 </span><span class="lineNoCov">               0:       fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Too many tables in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">      99 </span><span class="lineNoCov">               0:       fclose(fp);</span>
<span class="lineNum">     100 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     101 </span>                :     }
<span class="lineNum">     102 </span><span class="lineNoCov">               0:     table[0] = (<B><FONT COLOR="#228B22">unsigned</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     103 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">for</FONT></B> (i = 1; i &lt; DCTSIZE2; i++) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     104 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_text_integer(fp, &amp;val, &amp;termchar)) {</span>
<span class="lineNum">     105 </span><span class="lineNoCov">               0: 	fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Invalid table data in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     106 </span><span class="lineNoCov">               0: 	fclose(fp);</span>
<span class="lineNum">     107 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     108 </span>                :       }
<span class="lineNum">     109 </span><span class="lineNoCov">               0:       table[i] = (<B><FONT COLOR="#228B22">unsigned</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="lineNum">     110 </span>                :     }
<span class="lineNum">     111 </span><span class="lineNoCov">               0:     jpeg_add_quant_table(cinfo, tblno, table, scale_factor, force_baseline);</span>
<span class="lineNum">     112 </span><span class="lineNoCov">               0:     tblno++;</span>
<span class="lineNum">     113 </span>                :   }
<span class="lineNum">     114 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     115 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (termchar != EOF) {</span>
<span class="lineNum">     116 </span><span class="lineNoCov">               0:     fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Non-numeric data in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     117 </span><span class="lineNoCov">               0:     fclose(fp);</span>
<span class="lineNum">     118 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     119 </span>                :   }
<span class="lineNum">     120 </span>                : 
<span class="lineNum">     121 </span><span class="lineNoCov">               0:   fclose(fp);</span>
<span class="lineNum">     122 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">     123 </span>                : }
<span class="lineNum">     124 </span>                : 
<span class="lineNum">     125 </span>                : 
<span class="lineNum">     126 </span>                : #<B><FONT COLOR="#5F9EA0">ifdef</FONT></B> <FONT COLOR="#B8860B">C_MULTISCAN_FILES_SUPPORTED</FONT>
<span class="lineNum">     127 </span>                : 
<span class="lineNum">     128 </span>                : <B><FONT COLOR="#0000FF">LOCAL</FONT></B>(boolean)
<span class="lineNum">     129 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">read_scan_integer</FONT></B> (FILE * file, <B><FONT COLOR="#228B22">long</FONT></B> * result, <B><FONT COLOR="#228B22">int</FONT></B> * termchar)</span>
<span class="lineNum">     130 </span>                : <I><FONT COLOR="#B22222">/* Variant of read_text_integer that always looks for a non-space termchar;
<span class="lineNum">     131 </span>                :  * this simplifies parsing of punctuation in scan scripts.
<span class="lineNum">     132 </span>                :  */</FONT></I>
<span class="lineNum">     133 </span>                : {
<span class="lineNum">     134 </span>                :   <B><FONT COLOR="#228B22">register</FONT></B> <B><FONT COLOR="#228B22">int</FONT></B> ch;
<span class="lineNum">     135 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     136 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (! read_text_integer(file, result, termchar))</span>
<span class="lineNum">     137 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     138 </span><span class="lineNoCov">               0:   ch = *termchar;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
</span><span class="lineNum">     139 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">while</FONT></B> (ch != EOF &amp;&amp; isspace(ch))</span>
<span class="lineNum">     140 </span><span class="lineNoCov">               0:     ch = text_getc(file);</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     141 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (isdigit(ch)) {		<I><FONT COLOR="#B22222">/* oops, put it back */</FONT></I></span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     142 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (ungetc(ch, file) == EOF)</span>
<span class="lineNum">     143 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     144 </span><span class="lineNoCov">               0:     ch = <B><FONT COLOR="#BC8F8F">' '</FONT></B>;</span>
<span class="lineNum">     145 </span>                :   } <B><FONT COLOR="#A020F0">else</FONT></B> {
<span class="lineNum">     146 </span>                :     <I><FONT COLOR="#B22222">/* Any separators other than ';' and ':' are ignored;
<span class="lineNum">     147 </span>                :      * this allows user to insert commas, etc, if desired.
<span class="lineNum">     148 </span>                :      */</FONT></I>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 5 not taken</span>
</span><span class="lineNum">     149 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (ch != EOF &amp;&amp; ch != <B><FONT COLOR="#BC8F8F">';'</FONT></B> &amp;&amp; ch != <B><FONT COLOR="#BC8F8F">':'</FONT></B>)</span>
<span class="lineNum">     150 </span><span class="lineNoCov">               0:       ch = <B><FONT COLOR="#BC8F8F">' '</FONT></B>;</span>
<span class="lineNum">     151 </span>                :   }
<span class="lineNum">     152 </span><span class="lineNoCov">               0:   *termchar = ch;</span>
<span class="lineNum">     153 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">     154 </span>                : }
<span class="lineNum">     155 </span>                : 
<span class="lineNum">     156 </span>                : 
<span class="lineNum">     157 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(boolean)
<span class="lineNum">     158 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">read_scan_script</FONT></B> (j_compress_ptr cinfo, <B><FONT COLOR="#228B22">char</FONT></B> * filename)</span>
<span class="lineNum">     159 </span>                : <I><FONT COLOR="#B22222">/* Read a scan script from the specified text file.
<span class="lineNum">     160 </span>                :  * Each entry in the file defines one scan to be emitted.
<span class="lineNum">     161 </span>                :  * Entries are separated by semicolons ';'.
<span class="lineNum">     162 </span>                :  * An entry contains one to four component indexes,
<span class="lineNum">     163 </span>                :  * optionally followed by a colon ':' and four progressive-JPEG parameters.
<span class="lineNum">     164 </span>                :  * The component indexes denote which component(s) are to be transmitted
<span class="lineNum">     165 </span>                :  * in the current scan.  The first component has index 0.
<span class="lineNum">     166 </span>                :  * Sequential JPEG is used if the progressive-JPEG parameters are omitted.
<span class="lineNum">     167 </span>                :  * The file is free format text: any whitespace may appear between numbers
<span class="lineNum">     168 </span>                :  * and the ':' and ';' punctuation marks.  Also, other punctuation (such
<span class="lineNum">     169 </span>                :  * as commas or dashes) can be placed between numbers if desired.
<span class="lineNum">     170 </span>                :  * Comments preceded by '#' may be included in the file.
<span class="lineNum">     171 </span>                :  * Note: we do very little validity checking here;
<span class="lineNum">     172 </span>                :  * jcmaster.c will validate the script parameters.
<span class="lineNum">     173 </span>                :  */</FONT></I>
<span class="lineNum">     174 </span>                : {
<span class="lineNum">     175 </span>                :   FILE * fp;
<span class="lineNum">     176 </span>                :   <B><FONT COLOR="#228B22">int</FONT></B> scanno, ncomps, termchar;
<span class="lineNum">     177 </span>                :   <B><FONT COLOR="#228B22">long</FONT></B> val;
<span class="lineNum">     178 </span>                :   jpeg_scan_info * scanptr;
<span class="lineNum">     179 </span>                : #<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">MAX_SCANS</FONT>  100		<I><FONT COLOR="#B22222">/* quite arbitrary limit */</FONT></I>
<span class="lineNum">     180 </span>                :   jpeg_scan_info scans[MAX_SCANS];
<span class="lineNum">     181 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     182 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> ((fp = fopen(filename, <B><FONT COLOR="#BC8F8F">&quot;r&quot;</FONT></B>)) == NULL) {</span>
<span class="lineNum">     183 </span><span class="lineNoCov">               0:     fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Can't open scan definition file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     184 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     185 </span>                :   }
<span class="lineNum">     186 </span><span class="lineNoCov">               0:   scanptr = scans;</span>
<span class="lineNum">     187 </span><span class="lineNoCov">               0:   scanno = 0;</span>
<span class="lineNum">     188 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     189 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">while</FONT></B> (read_scan_integer(fp, &amp;val, &amp;termchar)) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     190 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (scanno &gt;= MAX_SCANS) {</span>
<span class="lineNum">     191 </span><span class="lineNoCov">               0:       fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Too many scans defined in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     192 </span><span class="lineNoCov">               0:       fclose(fp);</span>
<span class="lineNum">     193 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     194 </span>                :     }
<span class="lineNum">     195 </span><span class="lineNoCov">               0:     scanptr-&gt;component_index[0] = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="lineNum">     196 </span><span class="lineNoCov">               0:     ncomps = 1;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     197 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">while</FONT></B> (termchar == <B><FONT COLOR="#BC8F8F">' '</FONT></B>) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     198 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (ncomps &gt;= MAX_COMPS_IN_SCAN) {</span>
<span class="lineNum">     199 </span><span class="lineNoCov">               0: 	fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Too many components in one scan in file %s\n&quot;</FONT></B>,</span>
<span class="lineNum">     200 </span>                : 		filename);
<span class="lineNum">     201 </span><span class="lineNoCov">               0: 	fclose(fp);</span>
<span class="lineNum">     202 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     203 </span>                :       }
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     204 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_scan_integer(fp, &amp;val, &amp;termchar))</span>
<span class="lineNum">     205 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">goto</FONT></B> <B><FONT COLOR="#5F9EA0">bogus</FONT></B>;</span>
<span class="lineNum">     206 </span><span class="lineNoCov">               0:       scanptr-&gt;component_index[ncomps] = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="lineNum">     207 </span><span class="lineNoCov">               0:       ncomps++;</span>
<span class="lineNum">     208 </span>                :     }
<span class="lineNum">     209 </span><span class="lineNoCov">               0:     scanptr-&gt;comps_in_scan = ncomps;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     210 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (termchar == <B><FONT COLOR="#BC8F8F">':'</FONT></B>) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
</span><span class="lineNum">     211 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_scan_integer(fp, &amp;val, &amp;termchar) || termchar != <B><FONT COLOR="#BC8F8F">' '</FONT></B>)</span>
<span class="lineNum">     212 </span>                : 	<B><FONT COLOR="#A020F0">goto</FONT></B> <B><FONT COLOR="#5F9EA0">bogus</FONT></B>;
<span class="lineNum">     213 </span><span class="lineNoCov">               0:       scanptr-&gt;Ss = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
</span><span class="lineNum">     214 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_scan_integer(fp, &amp;val, &amp;termchar) || termchar != <B><FONT COLOR="#BC8F8F">' '</FONT></B>)</span>
<span class="lineNum">     215 </span>                : 	<B><FONT COLOR="#A020F0">goto</FONT></B> <B><FONT COLOR="#5F9EA0">bogus</FONT></B>;
<span class="lineNum">     216 </span><span class="lineNoCov">               0:       scanptr-&gt;Se = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
</span><span class="lineNum">     217 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_scan_integer(fp, &amp;val, &amp;termchar) || termchar != <B><FONT COLOR="#BC8F8F">' '</FONT></B>)</span>
<span class="lineNum">     218 </span>                : 	<B><FONT COLOR="#A020F0">goto</FONT></B> <B><FONT COLOR="#5F9EA0">bogus</FONT></B>;
<span class="lineNum">     219 </span><span class="lineNoCov">               0:       scanptr-&gt;Ah = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
</span><span class="lineNum">     220 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (! read_scan_integer(fp, &amp;val, &amp;termchar))</span>
<span class="lineNum">     221 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">goto</FONT></B> <B><FONT COLOR="#5F9EA0">bogus</FONT></B>;</span>
<span class="lineNum">     222 </span><span class="lineNoCov">               0:       scanptr-&gt;Al = (<B><FONT COLOR="#228B22">int</FONT></B>) val;</span>
<span class="lineNum">     223 </span>                :     } <B><FONT COLOR="#A020F0">else</FONT></B> {
<span class="lineNum">     224 </span>                :       <I><FONT COLOR="#B22222">/* set non-progressive parameters */</FONT></I>
<span class="lineNum">     225 </span><span class="lineNoCov">               0:       scanptr-&gt;Ss = 0;</span>
<span class="lineNum">     226 </span><span class="lineNoCov">               0:       scanptr-&gt;Se = DCTSIZE2-1;</span>
<span class="lineNum">     227 </span><span class="lineNoCov">               0:       scanptr-&gt;Ah = 0;</span>
<span class="lineNum">     228 </span><span class="lineNoCov">               0:       scanptr-&gt;Al = 0;</span>
<span class="lineNum">     229 </span>                :     }
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
</span><span class="lineNum">     230 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (termchar != <B><FONT COLOR="#BC8F8F">';'</FONT></B> &amp;&amp; termchar != EOF) {</span>
<span class="lineNum">     231 </span>                : <B><FONT COLOR="#5F9EA0">bogus</FONT></B>:
<span class="lineNum">     232 </span><span class="lineNoCov">               0:       fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Invalid scan entry format in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     233 </span><span class="lineNoCov">               0:       fclose(fp);</span>
<span class="lineNum">     234 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     235 </span>                :     }
<span class="lineNum">     236 </span><span class="lineNoCov">               0:     scanptr++, scanno++;</span>
<span class="lineNum">     237 </span>                :   }
<span class="lineNum">     238 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     239 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (termchar != EOF) {</span>
<span class="lineNum">     240 </span><span class="lineNoCov">               0:     fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;Non-numeric data in file %s\n&quot;</FONT></B>, filename);</span>
<span class="lineNum">     241 </span><span class="lineNoCov">               0:     fclose(fp);</span>
<span class="lineNum">     242 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     243 </span>                :   }
<span class="lineNum">     244 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     245 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">if</FONT></B> (scanno &gt; 0) {</span>
<span class="lineNum">     246 </span>                :     <I><FONT COLOR="#B22222">/* Stash completed scan list in cinfo structure.
<span class="lineNum">     247 </span>                :      * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,
<span class="lineNum">     248 </span>                :      * but if you want to compress multiple images you'd want JPOOL_PERMANENT.
<span class="lineNum">     249 </span>                :      */</FONT></I>
<span class="lineNum">     250 </span><span class="lineNoCov">               0:     scanptr = (jpeg_scan_info *)</span>
<span class="lineNum">     251 </span><span class="lineNoCov">               0:       (*cinfo-&gt;mem-&gt;alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,</span>
<span class="lineNum">     252 </span>                : 				  scanno * SIZEOF(jpeg_scan_info));
<span class="lineNum">     253 </span><span class="lineNoCov">               0:     MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info));</span>
<span class="lineNum">     254 </span><span class="lineNoCov">               0:     cinfo-&gt;scan_info = scanptr;</span>
<span class="lineNum">     255 </span><span class="lineNoCov">               0:     cinfo-&gt;num_scans = scanno;</span>
<span class="lineNum">     256 </span>                :   }
<span class="lineNum">     257 </span>                : 
<span class="lineNum">     258 </span><span class="lineNoCov">               0:   fclose(fp);</span>
<span class="lineNum">     259 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">     260 </span>                : }
<span class="lineNum">     261 </span>                : 
<span class="lineNum">     262 </span>                : #<B><FONT COLOR="#5F9EA0">endif</FONT></B> <I><FONT COLOR="#B22222">/* C_MULTISCAN_FILES_SUPPORTED */</FONT></I>
<span class="lineNum">     263 </span>                : 
<span class="lineNum">     264 </span>                : 
<span class="lineNum">     265 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(boolean)
<span class="lineNum">     266 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">set_quant_slots</FONT></B> (j_compress_ptr cinfo, <B><FONT COLOR="#228B22">char</FONT></B> *arg)</span>
<span class="lineNum">     267 </span>                : <I><FONT COLOR="#B22222">/* Process a quantization-table-selectors parameter string, of the form
<span class="lineNum">     268 </span>                :  *     N[,N,...]
<span class="lineNum">     269 </span>                :  * If there are more components than parameters, the last value is replicated.
<span class="lineNum">     270 </span>                :  */</FONT></I>
<span class="lineNum">     271 </span>                : {
<span class="lineNum">     272 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#228B22">int</FONT></B> val = 0;			<I><FONT COLOR="#B22222">/* default table # */</FONT></I></span>
<span class="lineNum">     273 </span>                :   <B><FONT COLOR="#228B22">int</FONT></B> ci;
<span class="lineNum">     274 </span>                :   <B><FONT COLOR="#228B22">char</FONT></B> ch;
<span class="lineNum">     275 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     276 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">for</FONT></B> (ci = 0; ci &lt; MAX_COMPONENTS; ci++) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     277 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (*arg) {</span>
<span class="lineNum">     278 </span><span class="lineNoCov">               0:       ch = <B><FONT COLOR="#BC8F8F">','</FONT></B>;			<I><FONT COLOR="#B22222">/* if not set by sscanf, will be ',' */</FONT></I></span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     279 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (sscanf(arg, <B><FONT COLOR="#BC8F8F">&quot;%d%c&quot;</FONT></B>, &amp;val, &amp;ch) &lt; 1)</span>
<span class="lineNum">     280 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     281 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (ch != <B><FONT COLOR="#BC8F8F">','</FONT></B>)		<I><FONT COLOR="#B22222">/* syntax check */</FONT></I></span>
<span class="lineNum">     282 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
</span><span class="lineNum">     283 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (val &lt; 0 || val &gt;= NUM_QUANT_TBLS) {</span>
<span class="lineNum">     284 </span><span class="lineNoCov">               0: 	fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;JPEG quantization tables are numbered 0..%d\n&quot;</FONT></B>,</span>
<span class="lineNum">     285 </span>                : 		NUM_QUANT_TBLS-1);
<span class="lineNum">     286 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     287 </span>                :       }
<span class="lineNum">     288 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].quant_tbl_no = val;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
</span><span class="lineNum">     289 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">while</FONT></B> (*arg &amp;&amp; *arg++ != <B><FONT COLOR="#BC8F8F">','</FONT></B>) <I><FONT COLOR="#B22222">/* advance to next segment of arg string */</FONT></I></span>
<span class="lineNum">     290 </span>                : 	;
<span class="lineNum">     291 </span>                :     } <B><FONT COLOR="#A020F0">else</FONT></B> {
<span class="lineNum">     292 </span>                :       <I><FONT COLOR="#B22222">/* reached end of parameter, set remaining components to last table */</FONT></I>
<span class="lineNum">     293 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].quant_tbl_no = val;</span>
<span class="lineNum">     294 </span>                :     }
<span class="lineNum">     295 </span>                :   }
<span class="lineNum">     296 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">     297 </span>                : }
<span class="lineNum">     298 </span>                : 
<span class="lineNum">     299 </span>                : 
<span class="lineNum">     300 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(boolean)
<span class="lineNum">     301 </span><span class="lineNoCov">               0: <B><FONT COLOR="#0000FF">set_sample_factors</FONT></B> (j_compress_ptr cinfo, <B><FONT COLOR="#228B22">char</FONT></B> *arg)</span>
<span class="lineNum">     302 </span>                : <I><FONT COLOR="#B22222">/* Process a sample-factors parameter string, of the form
<span class="lineNum">     303 </span>                :  *     HxV[,HxV,...]
<span class="lineNum">     304 </span>                :  * If there are more components than parameters, &quot;1x1&quot; is assumed for the rest.
<span class="lineNum">     305 </span>                :  */</FONT></I>
<span class="lineNum">     306 </span>                : {
<span class="lineNum">     307 </span>                :   <B><FONT COLOR="#228B22">int</FONT></B> ci, val1, val2;
<span class="lineNum">     308 </span>                :   <B><FONT COLOR="#228B22">char</FONT></B> ch1, ch2;
<span class="lineNum">     309 </span>                : 
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     310 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">for</FONT></B> (ci = 0; ci &lt; MAX_COMPONENTS; ci++) {</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     311 </span><span class="lineNoCov">               0:     <B><FONT COLOR="#A020F0">if</FONT></B> (*arg) {</span>
<span class="lineNum">     312 </span><span class="lineNoCov">               0:       ch2 = <B><FONT COLOR="#BC8F8F">','</FONT></B>;		<I><FONT COLOR="#B22222">/* if not set by sscanf, will be ',' */</FONT></I></span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">     313 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (sscanf(arg, <B><FONT COLOR="#BC8F8F">&quot;%d%c%d%c&quot;</FONT></B>, &amp;val1, &amp;ch1, &amp;val2, &amp;ch2) &lt; 3)</span>
<span class="lineNum">     314 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 5 not taken</span>
</span><span class="lineNum">     315 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> ((ch1 != <B><FONT COLOR="#BC8F8F">'x'</FONT></B> &amp;&amp; ch1 != <B><FONT COLOR="#BC8F8F">'X'</FONT></B>) || ch2 != <B><FONT COLOR="#BC8F8F">','</FONT></B>) <I><FONT COLOR="#B22222">/* syntax check */</FONT></I></span>
<span class="lineNum">     316 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 4 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 5 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 6 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 7 not taken</span>
</span><span class="lineNum">     317 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">if</FONT></B> (val1 &lt;= 0 || val1 &gt; 4 || val2 &lt;= 0 || val2 &gt; 4) {</span>
<span class="lineNum">     318 </span><span class="lineNoCov">               0: 	fprintf(stderr, <B><FONT COLOR="#BC8F8F">&quot;JPEG sampling factors must be 1..4\n&quot;</FONT></B>);</span>
<span class="lineNum">     319 </span><span class="lineNoCov">               0: 	<B><FONT COLOR="#A020F0">return</FONT></B> FALSE;</span>
<span class="lineNum">     320 </span>                :       }
<span class="lineNum">     321 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].h_samp_factor = val1;</span>
<span class="lineNum">     322 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].v_samp_factor = val2;</span>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 2 not taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 3 not taken</span>
</span><span class="lineNum">     323 </span><span class="lineNoCov">               0:       <B><FONT COLOR="#A020F0">while</FONT></B> (*arg &amp;&amp; *arg++ != <B><FONT COLOR="#BC8F8F">','</FONT></B>) <I><FONT COLOR="#B22222">/* advance to next segment of arg string */</FONT></I></span>
<span class="lineNum">     324 </span>                : 	;
<span class="lineNum">     325 </span>                :     } <B><FONT COLOR="#A020F0">else</FONT></B> {
<span class="lineNum">     326 </span>                :       <I><FONT COLOR="#B22222">/* reached end of parameter, set remaining components to 1x1 sampling */</FONT></I>
<span class="lineNum">     327 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].h_samp_factor = 1;</span>
<span class="lineNum">     328 </span><span class="lineNoCov">               0:       cinfo-&gt;comp_info[ci].v_samp_factor = 1;</span>
<span class="lineNum">     329 </span>                :     }
<span class="lineNum">     330 </span>                :   }
<span class="lineNum">     331 </span><span class="lineNoCov">               0:   <B><FONT COLOR="#A020F0">return</FONT></B> TRUE;</span>
<span class="lineNum">     332 </span>                : }
</pre>
<hr>
Generated: 2016-04-07&nbsp;18:20 by <a href="http://minormatter.com/zcov">zcov</a><br>
</body>
</html>
